package com.fau.fm.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang.time.DateFormatUtils;
import org.hibernate.annotations.GenericGenerator;
import org.json.simple.JSONAware;
import org.json.simple.JSONObject;

/**
 * @desc 统计信息订单已回款查询
 * @author dangjh
 * @datetime 2014年11月23日,下午1:17:20
 */
@Entity
@Table(name = "medical_order_has_back_section")
public class MedicalOrderHasBackSection implements Serializable, JSONAware {

	private static final long serialVersionUID = -8254255836360831385L;

	private String id;
	private String serialNum;		// 编号
	private String status;			// 订单状态
	private String cusSerId;		// 客服代表id
	private String name;			// 收货人
	private String contactNo;		// 联系电话
	private String address;			// 详细地址
	private String zipCode;			// 邮编
	private String customerId;		// 客户id
	private String remark;			// 备注
	private String invoice;			// 是否开发票 0否1是
	private String mediaId;			// 媒体id
	private String nature;			// 订单性质
	private String expressId;		// 物流公司id
	private String expressNo;		// 快递单号
	private BigDecimal payment;		// 货款
	private BigDecimal freight;		// 运费
	private BigDecimal receivable;	// 应收金额
	private BigDecimal amountPaid;	// 实收金额
	private Integer usePoints;		// 使用积分
	private Integer points;			// 本单积分
	private Integer useRed;			// 使用红包
	private Integer red;			// 本单红包
	private String allocationStatus;// 分配状态
	private String payType;			// 支付方式
	private String hospitalId;		// 医院id
	private String centerId;		// 中心id
	private String groupId;			// 组id
	private String checkUserId;			// 用户id
	private String claimUserId;		// 认领用户id
	
	private Date createTime;		// 下单时间
	private Date signTime;			// 签收时间
	
	private Date updateTime = new Date();	// 修改时间
	private Date startTime;					// 查询开始时间
	private Date endTime;					// 查询结束时间
	private String keyType;			// 字典表类型
	private String keyPid;			// 字典表父id
	private String cusSerName;		// 客服代表姓名
	private Integer countOrderNum;	// 订单数量
	private BigDecimal totalMoney;	// 总金额
	
	@Id
	@GenericGenerator(name = "generator", strategy = "assigned")
	@GeneratedValue(generator = "generator")
	@Column(name = "id", length = 32)
	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "serial_num", length = 50)
	public String getSerialNum() {
		return serialNum;
	}

	public void setSerialNum(String serialNum) {
		this.serialNum = serialNum;
	}

	@Column(name = "status", length = 30)
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name = "cus_ser_id", length = 32)
	public String getCusSerId() {
		return cusSerId;
	}

	public void setCusSerId(String cusSerId) {
		this.cusSerId = cusSerId;
	}
	
	@Column(name = "name", length = 10)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@Column(name = "contact_no", length = 20)
	public String getContactNo() {
		return contactNo;
	}

	public void setContactNo(String contactNo) {
		this.contactNo = contactNo;
	}

	@Column(name = "address", length = 255)
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "zip_code", length = 10)
	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	@Column(name = "customer_id", length = 32)
	public String getCustomerId() {
		return customerId;
	}

	public void setCustomerId(String customerId) {
		this.customerId = customerId;
	}

	@Column(name = "remark", length = 255)
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "invoice", length = 5)
	public String getInvoice() {
		return invoice;
	}

	public void setInvoice(String invoice) {
		this.invoice = invoice;
	}

	@Column(name = "media_id", length = 32)
	public String getMediaId() {
		return mediaId;
	}

	public void setMediaId(String mediaId) {
		this.mediaId = mediaId;
	}

	@Column(name = "nature", length = 32)
	public String getNature() {
		return nature;
	}

	public void setNature(String nature) {
		this.nature = nature;
	}

	@Column(name = "express_id", length = 32)
	public String getExpressId() {
		return expressId;
	}

	public void setExpressId(String expressId) {
		this.expressId = expressId;
	}

	@Column(name = "express_no", length = 20)
	public String getExpressNo() {
		return expressNo;
	}

	public void setExpressNo(String expressNo) {
		this.expressNo = expressNo;
	}

	@Column(name = "payment", length = 11)
	public BigDecimal getPayment() {
		return payment;
	}

	public void setPayment(BigDecimal payment) {
		this.payment = payment;
	}

	@Column(name = "freight", length = 11)
	public BigDecimal getFreight() {
		return freight;
	}

	public void setFreight(BigDecimal freight) {
		this.freight = freight;
	}

	@Column(name = "receivable", length = 11)
	public BigDecimal getReceivable() {
		return receivable;
	}

	public void setReceivable(BigDecimal receivable) {
		this.receivable = receivable;
	}

	@Column(name = "amount_paid", length = 11)
	public BigDecimal getAmountPaid() {
		return amountPaid;
	}

	public void setAmountPaid(BigDecimal amountPaid) {
		this.amountPaid = amountPaid;
	}

	@Column(name = "use_points", length = 11)
	public Integer getUsePoints() {
		return usePoints;
	}

	public void setUsePoints(Integer usePoints) {
		this.usePoints = usePoints;
	}

	@Column(name = "points", length = 11)
	public Integer getPoints() {
		return points;
	}

	public void setPoints(Integer points) {
		this.points = points;
	}

	@Column(name = "use_red", length = 11)
	public Integer getUseRed() {
		return useRed;
	}

	public void setUseRed(Integer useRed) {
		this.useRed = useRed;
	}

	@Column(name = "red", length = 11)
	public Integer getRed() {
		return red;
	}

	public void setRed(Integer red) {
		this.red = red;
	}
	
	@Column(name = "allocation_status", length = 5)
	public String getAllocationStatus() {
		return allocationStatus;
	}

	public void setAllocationStatus(String allocationStatus) {
		this.allocationStatus = allocationStatus;
	}
	
	@Column(name = "pay_type", length = 20)
	public String getPayType() {
		return payType;
	}

	public void setPayType(String payType) {
		this.payType = payType;
	}

	@Column(name = "hospital_id", length = 32)
	public String getHospitalId() {
		return hospitalId;
	}

	public void setHospitalId(String hospitalId) {
		this.hospitalId = hospitalId;
	}
	
	@Column(name = "center_id", length = 32)
	public String getCenterId() {
		return centerId;
	}

	public void setCenterId(String centerId) {
		this.centerId = centerId;
	}
	
	@Column(name = "group_id", length = 32)
	public String getGroupId() {
		return groupId;
	}

	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}

	@Column(name = "check_user_id", length = 32)
	public String getCheckUserId() {
		return checkUserId;
	}

	public void setCheckUserId(String checkUserId) {
		this.checkUserId = checkUserId;
	}
	
	@Column(name = "claim_user_id", length = 32)
	public String getClaimUserId() {
		return claimUserId;
	}

	public void setClaimUserId(String claimUserId) {
		this.claimUserId = claimUserId;
	}

	@Column(name = "sign_time")
	public Date getSignTime() {
		return signTime;
	}

	public void setSignTime(Date signTime) {
		this.signTime = signTime;
	}

	@Column(name = "create_time")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "update_time")
	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	@Transient
	public Date getStartTime() {
		return startTime;
	}
	
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	
	@Transient
	public Date getEndTime() {
		return endTime;
	}
	
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	
	@Transient
	public String getKeyType() {
		return keyType;
	}

	public void setKeyType(String keyType) {
		this.keyType = keyType;
	}

	@Transient
	public String getKeyPid() {
		return keyPid;
	}

	public void setKeyPid(String keyPid) {
		this.keyPid = keyPid;
	}

	@Transient
	public String getCusSerName() {
		return cusSerName;
	}

	public void setCusSerName(String cusSerName) {
		this.cusSerName = cusSerName;
	}

	@Transient
	public Integer getCountOrderNum() {
		return countOrderNum;
	}

	public void setCountOrderNum(Integer countOrderNum) {
		this.countOrderNum = countOrderNum;
	}
	
	@Transient
	public BigDecimal getTotalMoney() {
		return totalMoney;
	}

	public void setTotalMoney(BigDecimal totalMoney) {
		this.totalMoney = totalMoney;
	}

	@SuppressWarnings("unchecked")
	@Override
	public String toJSONString() {
		JSONObject obj = new JSONObject();
		obj.put("id", id);
		obj.put("serialNum", serialNum);
		obj.put("status", status);
		obj.put("cusSerId", cusSerId);
		obj.put("customerId", customerId);
		obj.put("address", address);
		obj.put("remark", remark);
		obj.put("invoice", invoice);
		obj.put("mediaId", mediaId);
		obj.put("nature", nature);
		obj.put("expressId", expressId);
		obj.put("expressNo", expressNo);
		obj.put("payment", payment);
		obj.put("freight", freight);
		obj.put("receivable", receivable);
		obj.put("amountPaid", amountPaid);
		obj.put("payType", payType);
		obj.put("usePoints", usePoints);
		obj.put("points", points);
		obj.put("useRed", useRed);
		obj.put("red", red);
		obj.put("hospitalId", hospitalId);
		obj.put("centerId", centerId);
		obj.put("groupId", groupId);
		obj.put("checkUserId", checkUserId);
		obj.put("cusSerName", cusSerName);
		obj.put("countOrderNum", countOrderNum);
		obj.put("totalMoney", totalMoney);
		obj.put("name", name);
		if(null != createTime) {
			obj.put("createTime", DateFormatUtils.format(createTime, "yyyy-MM-dd HH:mm"));
		}
		if(null != signTime) {
			obj.put("signTime", DateFormatUtils.format(signTime, "yyyy-MM-dd HH:mm"));
		}
		return obj.toString();
	}

}
